package demo2;

public class Derived extends Base{
    public int c = 30;
    public int a = 50;
    public int b = 40;
    public Derived() {
        super();
        System.out.println("子类的构造方法");
    }
    static {
        System.out.println("子类的静态代码块");
    }
    {
        System.out.println("子类的实例代码块");
    }
    public void func1(int c) {
        System.out.println("Derived中的func1");
    }
    public void func2() {
        System.out.println("Derived中的func2");
    }
    public void method() {
        func1();
        func1(30);
        super.func2();
        func2();
    }
    public void func() {
        System.out.println("父类的a:"+super.a);
        System.out.println("父类的b:"+super.b);
        System.out.println(this.a);//访问子类自己的a
        System.out.println(this.b);//访问子类自己的b
        System.out.println(this.c);//访问子类自己的c
    }
}
